import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12

import "qrc:/_context/Basic"
import "qrc:/_context/CusCheckBox"
import "qrc:/_context/CusInput"
import "qrc:/_context/CusGroupBox"
import "qrc:/_context/CusComboBox"
import "qrc:/_context/CusButton"

Rectangle  {
    id: modbusItemRec;

    // 寄存器起始地址
    property string g_registerBegin: _registerBegin.text;
    // 寄存器结束地址
    property string g_registerEnd: _registerEnd.text;

    // 工况点类型
    property int g_OperatePointType: _opType.currentIndex;
    // 工况点的系数
    property int g_OperatePointCoeffi: _opCoefficient.currentIndex;

    // 工况点对应的寄存器数量
    // property int g_OperatePointOfRegisterNum: _opOfregisterNum.currentIndex;

    signal destroyMyself(var object);

    RowLayout{
        spacing: 12;

        YaheiText{
            text: "起始地址:";
        }
        HldTextField{
            id: _registerBegin;
            width: 80;
            text: "40201";
        }

        YaheiText{
            text: "结束地址:";
        }
        HldTextField{
            id: _registerEnd;
            width: 80;
            text: "40210";
        }

        // 步长
        // YaheiText{
        //     text: "步长:";
        // }
        // CusComboBox{
        //     model:["1", "2"];
        // }

        // 工况点类型
        YaheiText{
            text: "工况点类型:";
        }
        CusComboBox{
            id: _opType;
            implicitWidth: 180;
            model:["数字量#", "开关量", "模拟量(无符号)*", "单浮点数(abcd)*", "单浮点数(badc)", "单浮点数(dcba)", "模拟量(有符号)"];

            // 设置默认选中第三个选项
            currentIndex: 2;
        }

        // 工况点对应的寄存器数量
        // YaheiText{
        //     text: "工况点对应的寄存器数量:";
        // }
        // CusComboBox{
        //     id: _opOfregisterNum;
        //     model:["1", "2"];
        // }

        // operation point
        // 工况点的系数
        YaheiText{
            text: "工况点系数:";
        }
        CusComboBox{
            id: _opCoefficient;
            model:["÷/x 1", "÷ 10", "÷ 100", "x 10", "x 100"];
        }


        CusButton{
            text: "删除";
            onClicked: {
                destroyMyself(modbusItemRec);
            }
        }

    }
}
